<%@page import="java.util.TreeSet"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.TreeMap"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	String group = "Line";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Insert title here</title>
<SCRIPT LANGUAGE="Javascript"
	SRC="<%=path%>/FusionChart/Includes/js/FusionCharts.js"></SCRIPT>
</head>
<body>
	<%
		TreeMap<String, String> monthMap = (TreeMap<String, String>) request
				.getAttribute("monthMap");

		String year = request.getAttribute("year").toString();

		TreeSet yearsSet = (TreeSet) request.getAttribute("yearsSet");

		Object[] years = yearsSet.toArray();

		StringBuffer strBuf = new StringBuffer();
		strBuf.append("<chart caption='业绩月K线图' showNames='1' decimalPrecision='0'>");
	%>
	<%
		Object[] keys = monthMap.keySet().toArray();
		for (int i = 0; i < keys.length; i++) {
			strBuf.append("<set label='" + keys[i].toString() + "月"
					+ "' value='" + monthMap.get(keys[i].toString())
					+ "' />");
		}

		strBuf.append("</chart>");
		//String newString = new String(strBuf.toString().getBytes(""),"iso-8859-1");
		/**
		此处必须引到FusionChart下的/Includes/swf/文件夹
		 */
		String graphType = path + "/FusionChart/Includes/swf/" + group
				+ ".swf";
		request.setCharacterEncoding("UTF-8");
	%>
	<center>
		<h2 id="showTitle">业绩月K线图</h2>
		<br />

		<div id="showGraph">
			<jsp:include
				page="../FusionChart/Includes/jsp/FusionChartsHTMLRenderer.jsp"
				flush="true">
				<jsp:param name="chartSWF" value="<%=graphType%>" />
				<jsp:param name="strURL" value="" />
				<jsp:param name="strXML" value="<%=strBuf.toString()%>" />
				<jsp:param name="chartId" value="accounts_code" />
				<jsp:param name="chartWidth" value="800" />
				<jsp:param name="chartHeight" value="450" />
				<jsp:param name="debugMode" value="false" />
			</jsp:include>
		</div>
		<div>
			<form action="<%=path%>/showMonthKGraph" method="post"
				name="showMonthInYear">
				<select name="year">
					<%
						for (int i = years.length - 1; i >= 0; i--) {
							if (year.equals(years[i])) {
					%>
					<option value="<%=years[i]%>" selected><%=years[i]%></option>
					<%
						} else {
					%>
					<option value="<%=years[i]%>"><%=years[i]%></option>
					<%
						}
						}
					%>
				</select>年 <input type="submit" value="查看">
			</form>
		</div>
	</center>
</body>
</html>